package main

import "strings"

func main() {

}

func truncateSentence(s string, k int) string {
	str := strings.Builder{}
	k -= 1
	for i := range s {

		if s[i] == ' ' {
			if k == 0 {
				return str.String()
			}
			k--
		}
		str.WriteByte(s[i])
	}
	return str.String()
}
